/**
 * @author David Young
 */
package csab;

import org.newdawn.slick.Color;
import org.newdawn.slick.Font;
import org.newdawn.slick.geom.Rectangle;

/**
 * Represents a text menu object on the screen.
 * @author David Young
 */
	
@SuppressWarnings("serial")
public class MenuObject extends Rectangle
{
	private String text;
	private Font font;
	private Color color;
	private Color pressed;
	private Color current;
	/**
	 * @param x The x location of the object.
	 * @param y The y location of the object.
	 * @param txt The text within the object.
	 * @param fnt The font of the text within the object.
	 */
	public MenuObject(float x, float y, String txt, Font fnt, Color col, Color colpress) {
		super(x - fnt.getWidth(txt) / 2, y - fnt.getHeight(txt) / 2, 
			  fnt.getWidth(txt), fnt.getHeight(txt));
		text = txt;
		font = fnt;
		color = col;
		current = color;
		pressed = colpress;
	}
	
	public void draw()
	{
		font.drawString(this.x, this.y, text, current);
	}
	
	public void handlePressed()
	{
		current = pressed;
	}
	
	public void handleReleased()
	{
		current = color;
	}
	
}
